<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateSampleInoutRecordsTable extends Migration
{

    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('sample_inout_records', function (Blueprint $table) {
            $table->increments('id');
            $table->string('code')->unique()->comment('编号');
            $table->string('description')->nullable()->comment('描述');
            $table->unsignedTinyInteger('state')->default(0)->comment('状态，0:新建,1:流程中,2:完成,3:作废');
            $table->unsignedTinyInteger('type')->comment('类型，0:发送单,1:接收单');
            $table->unsignedInteger('entered_by')->comment('录入人');
            $table->dateTime('enter_date')->nullable()->comment('录入时间');
            $table->unsignedInteger('checked_group')->nullable()->comment('审核组');
            $table->unsignedInteger('checked_by')->nullable()->comment('审核人');
            $table->unsignedInteger('submitted_by')->nullable()->comment('提交人');
            $table->dateTime('submit_time')->nullable()->comment('提交时间');
            $table->dateTime('inout_date')->nullable()->comment('发送/接收日期');
            $table->string('express_company')->nullable()->comment('发送快递公司(从字典选择)');
            $table->string('express_number')->nullable()->comment('发送快递单号');
            $table->unsignedInteger('project')->nullable()->comment('合同编号');
            $table->unsignedInteger('salesman')->nullable()->comment('所属销售');
            $table->unsignedInteger('created_by')->comment('创建者');
            $table->unsignedInteger('updated_by')->comment('更新者');
            $table->string('data_scope')->nullable()->comment('数据域');
            $table->timestamps();

            $table->comment = '样本发送/接收单表';
            $table->engine = 'InnoDB';
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('sample_inout_records');
    }

}
